/*
 *  Cero Project - Copyright   2006 The Cero Developement Team 
 *  (Michael Laguerre, Camille Roux, Matthieu Segret, Mathieu Sivade) 
 * 
 *  This program is free software; you can redistribute it and/or modify it 
 *  under the terms of the GNU General Public License as published by the Free 
 *  Software Foundation; either version 2 of the License, or (at your option) 
 *  any later version.
 * 
 *  This program is distributed in the hope that it will be useful, but 
 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 *  or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 *  for more details.
 */

package org.ceroproject.games;

import java.util.Collection;

/**
 * Groups informations about actions. That is the game, the player, the zones
 * and cards concerned at the moment the action occured.
 * 
 * @author Telem
 */
public class ActionEvent {
	/** The game in which the action took place */
	private Game game;

	/** The player which originated the action */
	private Player player;

	/** The zone the cards came from */
	private Zone zoneFrom;

	/** The zone the cards went to */
	private Zone zoneTo;

	/** The cards concerned by this action */
	private Collection<Card> cards;

	public ActionEvent(Game game, Player player, Zone from, Zone to,
			Collection<Card> cards) {
		this.cards = cards;
		this.game = game;
		this.player = player;
		zoneFrom = from;
		zoneTo = to;
	}

	/**
	 * Returns the cards concerned by this action (might be null)
	 * 
	 * @return the cards concerned by this action (might be null)
	 */
	public Collection<Card> getCards() {
		return cards;
	}

	/**
	 * Returns the game concerned by this action
	 * 
	 * @return the game concerned by this action
	 */
	public Game getGame() {
		return game;
	}


	/**
	 * Returns the player concerned by this action
	 * 
	 * @return the player concerned by this action
	 */
	public Player getPlayer() {
		return player;
	}

	/**
	 * Returns the zone the cards came from (might be null)
	 * 
	 * @return the zone the cards came from (might be null)
	 */
	public Zone getZoneFrom() {
		return zoneFrom;
	}

	/**
	 * Returns the zone the cards went to (might be null)
	 * 
	 * @return the zone the cards went to (might be null)
	 */
	public Zone getZoneTo() {
		return zoneTo;
	}

	public String toString() {
		return "GameType : "+game.getClass().getName()+"\n"+
			"Player : "+player+"\n"+
			"ZoneFrom : "+zoneFrom+"\n"+
			"ZoneTo : "+zoneTo+"\n"+
			"Cards : "+cards+"\n";
	}
}
